<%@ page language="java" import="java.util.*, model.*" pageEncoding="ISO-8859-1"%>
<%@page import="bean.Poll,bean.Question"%>
<%
Integer pid = Integer.valueOf(request.getParameter("id")).intValue();
Integer pver = Integer.valueOf(request.getParameter("ver")).intValue(); 
String pname = request.getParameter("name");
String pdes = request.getParameter("des");
ArrayList al = new ArrayList();
	al = PCShowQuestion.showQuestion(pid,pver);

%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>   
    <title><%= pname%>'s Information</title> 
    <script type="text/javascript" src="prototype.js"></script>
	<script type="text/javascript" src="scriptaculous.js"></script>
	<script type="text/javascript">
	document.observe("dom:loaded", bodyOnload);
    function bodyOnload() {
    $('Basic').show();
    $('Display').hide();
	$('Objects').hide();
	$('saBasic').show();
    $('saDisplay').hide();
	$('saObjects').hide();
}
	function transition(show, hide)
	{
		Effect.Appear(show);
		Effect.Fade(hide, { duration:0.1});
	}
	document.observe('dom:loaded', function()
	{$('SA').hide();
	});
	function changeFont()
	{
		var text = document.getElementById("text").value;
		var font = document.getElementById("font").value;
		document.getElementById("text").style.fontFamily = font;		
	}
	function changeSize()
	{
		var text = document.getElementById("text").value;
		var size = document.getElementById("size").value;
		document.getElementById("text").style.fontSize = size;		
	}
	function changeColor()
	{
		var text = document.getElementById("text").value;
		var color = document.getElementById("color").value;
		document.getElementById("text").style.color = color;		
	}
	function Alphanumaric()
	{
	document.getElementById("Numaric").style.display = "none";
	document.getElementById("Alphanumaric").style.display = "";
	}
	function Numaric()
	{
	document.getElementById("Numaric").style.display = "";
	document.getElementById("Alphanumaric").style.display = "none";
	}
	function Single()
	{
	document.getElementById("Range").style.display = "none";
	document.getElementById("Single").style.display = "";
	document.getElementById("Single").disabled = false;
	document.getElementById("Range").disabled = true;
	}
	function Range()
	{
	document.getElementById("Range").style.display = "";
	document.getElementById("Single").style.display = "none";
	document.getElementById("Single").disabled = true;
	document.getElementById("Range").disabled = false;
	}
	</script>
	<script type="text/javascript" language="javascript">

    var currentId = null;
    var currentIdd = null;
    var currentIddd = null;
    var currentIdddd = null;

    Effect.ShowHide = function (contentId) {
    	var slideDown = 0.5;
    	var slideUp = 0.5;

    	contentId = $(contentId);

    	if (currentId != contentId) {
    		new Effect.SlideDown(contentId, {duration: slideDown});
    		currentId = contentId;
    	} else {
    		new Effect.SlideUp(currentId, {duration: slideUp});
    		currentId = null;
    	}
    };
    Effect.ShowHidee = function (contentId) {
    	var slideDown = 0.5;
    	var slideUp = 0.5;

    	contentIdd = $(contentId);

    	if (currentIdd != contentId) {
    		new Effect.SlideDown(contentId, {duration: slideDown});   			
    		currentIdd = contentId;
    	} else {
    		new Effect.SlideUp(currentIdd, {duration: slideUp});
    		currentIdd = null;
    	}
    };
    Effect.ShowHideee = function (contentId) {
    	var slideDown = 0.5;
    	var slideUp = 0.5;

    	contentIddd = $(contentId);

    	if (currentIddd != contentId) {
    		new Effect.SlideDown(contentId, {duration: slideDown});   			
    		currentIddd = contentId;
    	} else {
    		new Effect.SlideUp(currentIddd, {duration: slideUp});
    		currentIddd = null;
    	}
    };
    Effect.ShowHideeee = function (contentId) {
    	var slideDown = 0.5;
    	var slideUp = 0.5;

    	contentIdddd = $(contentId);

    	if (currentIdddd != contentId) {
    		new Effect.SlideDown(contentId, {duration: slideDown});   			
    		currentIdddd = contentId;
    	} else {
    		new Effect.SlideUp(currentIdddd, {duration: slideUp});
    		currentIdddd = null;
    	}
    };
</script>
</head>
<body>	
	<div id="Information">
	<h1>Pollname: <%= pname%></h1>	
	<p>Description: <%= pdes%></p>
	
	<hr />			
	<div id="goods">
	<h1>Questions</h1>
			 <table border="1" Width="100%" cellpadding="0" cellspacing="0" color="red" >
				<thead>
				<tr id="row1" align="left">
				<th>ID</th>
				<th>Text</th>
				<th>Status</th>
				<th>Type</th>
				<th>CreateDate</th>
				</tr>
				</thead>
				
				
				<tbody>
				
				<%
									for (int i = 0; i < al.size(); i++) {
									
										Question pb = (Question) al.get(i);
								%>
				<form name = "aa" action = "DeleteQuestionServlet" method="post">	
				<tr id= <%=pb.getQuestionID()%>>		
				<td><a href='Question.jsp?id=<%=pb.getQuestionID()%>'><%=pb.getQuestionID()%></a></td>
				<td><%=pb.getText()%></td>
				<td><%=pb.getStatus()%></td>	
				<td><%=pb.getType()%></td>
				<td><%=pb.getQCreateTime()%></td>				
				<td><input type=submit value=Delete /></td>
				</tr>
				</form>
				<%
					}

						
				%>
				<hr />
				 
				</tbody>
			</table> 		
		</div >	
		<br/>
		<br/>
		<table border="1" width="300" >
		<tbody>
		<tr>
			<td align="center" class="whiteLink">
			<a href="#" onclick="transition('MC', 'SA')">MUTIPLE CHOICE</a></td>
			<td align="CENTER" class="whiteLink">
			<a href="#" onclick="transition('SA', 'MC')">SHORT ANSWER</a></td>
		</tr>
	</tbody>
	</table>
	<br/>
	<div id="MC">
		<form name = "mc" action = "AddQuestionServlet" method="post">
		<div><strong>Basic</strong></div>
		<div id="Basic">
		Text:	<input type = "text" name = "text" id = "text" size="50"/><br/>
		Status:	<input   type= "radio"   value= "0 "   checked   name= "Status">Open 
				<input   type= "radio"   value= "1 " 	name= "Status"   >Close
				<br/>
		Type:	<input   type= "radio"   value= "Normal "   checked   name= "Type">Normal
				<input   type= "radio"   value= "Demographic " 	name= "Type">Demographic
				<input   type= "radio"   value= "Comparative"   name= "Type">Comparative 
				<input   type= "radio"   value= "Ranking"   name= "Type">Ranking
				<br/>
		<div onclick="new Effect.ShowHide('Display');"><strong>Display Setting</strong></div>
		<div id="Display">
		Font: 	<select id="font" name="font" onchange="changeFont()" >	 	
				<option value="Arial">Arial</option>
				<option value="Comic Sans MS"> Comic Sans MS</option>
				<option value="Courier New"> Courier New</option>
				<option value="Georgia"> Georgia</option>
				<option value="Helvetica"> Helvetica</option>
				<option value="Lucida Grande"> Lucida Grande</option>
				<option value="Impact"> Impact</option>
				<option value="Tahoma"> Tahoma</option>
				<option value="Times New Roman" > Times New Roman</option>	
				<option value="Trebuchet MS"> Trebuchet MS</option> 
				<option value="Verdana" selected="selected"> Verdana </option>		
				</select>
				&nbsp &nbsp
		Size:	<select id="size" name="size" onchange="changeSize()" >	
				<option value="9"> 9</option>
				<option value="10"> 10</option>
				<option value="11"> 11</option>
				<option value="12"> 12</option>
				<option value="13" selected="selected"> 13</option>
				<option value="14"> 14</option>
				<option value="16"> 16</option>
				<option value="18"> 18</option>
				<option value="20"> 20</option> 
				<option value="22"> 22</option>
				<option value="24"> 24</option>
				<option value="26"> 26</option>
				<option value="28"> 28</option>
				<option value="36"> 36</option>
				<option value="48"> 48</option>
				<option value="72"> 72</option>		
				</select>
				&nbsp &nbsp
		Color: <select id="color" name="color" onchange="changeColor()" >	
				<option value="Black" selected="selected"> Black</option>
				<option value="DarkRed"> DarkRed</option>
				<option value="Red"> Red</option>
				<option value="Orange"> Orange</option>
				<option value="Yellow"> Yellow</option>
				<option value="LightGreen"> LightGreen</option>
				<option value="Green"> Green</option>
				<option value="LightBlue"> LightBlue</option>
				<option value="Blue"> Blue</option>
				<option value="DarkBlue"> DarkBlue</option>
				<option value="Purple" > Purple</option>
				</select>
				<br/>
		Chart Style: <select id="chartstyle" name="chartstyle" >	
				<option value="Vertical" selected="selected"> Vertical</option>
				<option value="Horizontal"> Horizontal</option>
				<option value="Pie"> Pie</option>
				</select>
				&nbsp &nbsp
		Chart Color:??		
		</div>
		<div onclick="new Effect.ShowHidee('Objects');"><strong>Interactive Objects</strong></div>
		<div id = "Objects">
		Timer:	<input   type= "radio"   value= "Yes" name= "timer">Yes 
				<input   type= "radio"   value= "No"  checked  name= "timer">No
				&nbsp &nbsp
		MaxTime: <select id="maxtime" name="maxtime" >	
				<option value="10"> 10</option>
				<option value="15"> 15</option>
				<option value="20"> 20</option>
				<option value="25"> 25</option>
				<option value="30" selected="selected"> 30</option>
				<option value="35"> 35</option>
				<option value="40"> 40</option>
				<option value="45"> 45</option>
				<option value="50"> 50</option> 
				<option value="55"> 55</option>
				<option value="60"> 60</option>
				<option value="75"> 75</option>
				<option value="90"> 90</option>
				<option value="120"> 120</option>
				<option value="150"> 150</option>
				<option value="180"> 180</option>
				</select><br/>
		Response Counter: 			<input   type= "radio"   value= "Yes" name= "RC">Yes 
									<input   type= "radio"   value= "No" checked  name= "RC">No
									<br/>
		Correct Answer Indicator: 	<input   type= "radio"   value= "Yes" name= "CAI">Yes 
									<input   type= "radio"   value= "No" checked  name= "CAI">No
		
		</div>
		<input type=submit value="Add Question"/>
		</form>
		</div>
	</div>
	<div id="SA">
	<form name = "sa" action = "AddQuestionServlet" method="post">
	<div><strong>Basic</strong></div>
		<div id="saBasic">
		Text:	<input type = "text" name = "text" id = "text"  size="50"/><br/>
		Status:	<input   type= "radio"   value= "0 "   checked   name= "Status">Open 
				<input   type= "radio"   value= "1 " 	name= "Status"   >Close
				<br/>
		Question Type: 	<input   type= "radio"   value= "6" checked name= "TemplateQuestion" onClick="Alphanumaric()">Alphanumeric 
						<input   type= "radio"   value= "5"  name= "TemplateQuestion" onClick="Numaric()">Numeric
						<br/>
		<div id="Alphanumaric">
			Correct Answer: <input type = "text" name = "Correct1" id = "Correct1" size="10"/>
						<input type = "text" name = "Correct2" id = "Correct2" size="10"/>
						<input type = "text" name = "Correct3" id = "Correct3" size="10"/>
						<input type = "text" name = "Correct4" id = "Correct4" size="10"/>
						<input type = "text" name = "Correct5" id = "Correct5" size="10"/>
		</div>
		<div id="Numaric" style="display:none">
		Type:	<input   type= "radio"   value= "Single" checked name= "ntype" onClick="Single()">Single 
				<input   type= "radio"   value= "Range"  name= "ntype" onClick="Range()"> Range
				&nbsp &nbsp
				<div id="Single">Correct Answer:<input type = "text" name = "numberonly" id = "numberonly" size="10"/></div>
		<div id="Range" style="display:none"  disabled=true >Lowest: <input type = "text" name = "Lowest" id = "Lowest" size="10"/>
		Highest: <input type = "text" name = "Highest" id = "Highest" size="10"/></div>
		</div>
		</div>
		<div onclick="new Effect.ShowHideee('saDisplay');"><strong>Display Setting</strong></div>
		<div id="saDisplay">
		Font: 	<select id="font" name="font" onchange="changeFont()" >	 	
				<option value="Arial">Arial</option>
				<option value="Comic Sans MS"> Comic Sans MS</option>
				<option value="Courier New"> Courier New</option>
				<option value="Georgia"> Georgia</option>
				<option value="Helvetica"> Helvetica</option>
				<option value="Lucida Grande"> Lucida Grande</option>
				<option value="Impact"> Impact</option>
				<option value="Tahoma"> Tahoma</option>
				<option value="Times New Roman" > Times New Roman</option>	
				<option value="Trebuchet MS"> Trebuchet MS</option> 
				<option value="Verdana" selected="selected"> Verdana </option>		
				</select>
				&nbsp &nbsp
		Size:	<select id="size" name="size" onchange="changeSize()" >	
				<option value="9"> 9</option>
				<option value="10"> 10</option>
				<option value="11"> 11</option>
				<option value="12"> 12</option>
				<option value="13" selected="selected"> 13</option>
				<option value="14"> 14</option>
				<option value="16"> 16</option>
				<option value="18"> 18</option>
				<option value="20"> 20</option> 
				<option value="22"> 22</option>
				<option value="24"> 24</option>
				<option value="26"> 26</option>
				<option value="28"> 28</option>
				<option value="36"> 36</option>
				<option value="48"> 48</option>
				<option value="72"> 72</option>		
				</select>
				&nbsp &nbsp
		Color: <select id="color" name="color" onchange="changeColor()" >	
				<option value="Black" selected="selected"> Black</option>
				<option value="DarkRed"> DarkRed</option>
				<option value="Red"> Red</option>
				<option value="Orange"> Orange</option>
				<option value="Yellow"> Yellow</option>
				<option value="LightGreen"> LightGreen</option>
				<option value="Green"> Green</option>
				<option value="LightBlue"> LightBlue</option>
				<option value="Blue"> Blue</option>
				<option value="DarkBlue"> DarkBlue</option>
				<option value="Purple" > Purple</option>
				</select>
				<br/>
		</div>
		<div onclick="new Effect.ShowHideeee('saObjects');"><strong>Interactive Objects</strong></div>
		<div id = "saObjects">
		Timer:	<input   type= "radio"   value= "Yes" name= "timer">Yes 
				<input   type= "radio"   value= "No"  checked  name= "timer">No
				&nbsp &nbsp
		MaxTime: <select id="maxtime" name="maxtime" >	
				<option value="10"> 10</option>
				<option value="15"> 15</option>
				<option value="20"> 20</option>
				<option value="25"> 25</option>
				<option value="30" selected="selected"> 30</option>
				<option value="35"> 35</option>
				<option value="40"> 40</option>
				<option value="45"> 45</option>
				<option value="50"> 50</option> 
				<option value="55"> 55</option>
				<option value="60"> 60</option>
				<option value="75"> 75</option>
				<option value="90"> 90</option>
				<option value="120"> 120</option>
				<option value="150"> 150</option>
				<option value="180"> 180</option>
				</select><br/>
		Response Counter: 			<input   type= "radio"   value= "Yes" name= "RC">Yes 
									<input   type= "radio"   value= "No" checked  name= "RC">No
									<br/>
		Correct Answer Indicator: 	<input   type= "radio"   value= "Yes" name= "CAI">Yes 
									<input   type= "radio"   value= "No" checked  name= "CAI">No
		
		</div>
	<input type=submit value="Add Question"/>
	</form>
	</div>
</body>
</html>
	 	 
	